package com.ltmonitor.web.util;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.persistence.Transient;

import com.ltmonitor.entity.FunctionModel;
import com.ltmonitor.entity.IEntity;
/**
 * 在线用户
 * @author www.jt808.com
 *
 */
public class OnlineUser implements  Serializable{
	
	private long userId;
	
	private String name;
	
	private String mapType;
	/**
	 * 是否超级用户
	 */
	private boolean superAdmin;
	/**
	 * 所属公司id
	 */
	private long companyId;
	/**
	 * 有权限的部门Id列表
	 */
	private List<Long> depIdList = new ArrayList<Long>();
	/**
	 * 权限Map, key是权限的编码，用于判断用户是否有一个指定的权限
	 */
	private Map<String, FunctionModel> funcMap = new HashMap<String, FunctionModel>();
	/**
	 * 登陆时间
	 */
	private Date loginTime;

	
	private int reloadTimes = 0;


	
	/**
	 * 用户是否有某个功能的权限
	 * 
	 * @param funcName
	 * @return
	 */
	public boolean isAuthorized(String funcName) {
		return  funcMap.containsKey(funcName);
	}

	public long getEntityId() {
		return userId;
	}

	public void setUserId(long userId) {
		this.userId = userId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<Long> getDepIdList() {
		return depIdList;
	}

	public void setDepIdList(List<Long> depIdList) {
		this.depIdList = depIdList;
	}

	public String getMapType() {
		return mapType;
	}

	public void setMapType(String mapType) {
		this.mapType = mapType;
	}

	public boolean isSuperAdmin() {
		return superAdmin;
	}

	public void setSuperAdmin(boolean superAdmin) {
		this.superAdmin = superAdmin;
	}
	/**
	 * 所属公司id
	 */
	public long getCompanyId() {
		return companyId;
	}


	public int getReloadTimes() {
		return reloadTimes;
	}

	public void setReloadTimes(int reloadTimes) {
		this.reloadTimes = reloadTimes;
	}

	public Date getLoginTime() {
		return loginTime;
	}

	public void setLoginTime(Date loginTime) {
		this.loginTime = loginTime;
	}

	public Map<String, FunctionModel> getFuncMap() {
		return funcMap;
	}

	public void setFuncMap(Map<String, FunctionModel> funcMap) {
		this.funcMap = funcMap;
	}

	public void setCompanyId(long companyId) {
		this.companyId = companyId;
	}

}
